<html>
<head><meta charset="utf-8"><title>Considering a future integration of the gcc backend · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend.html">Considering a future integration of the gcc backend</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="240135677"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Considering%20a%20future%20integration%20of%20the%20gcc%20backend/near/240135677" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> antoyo <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend.html#240135677">(May 25 2021 at 02:20)</a>:</h4>
<p>Hi.<br>
There's been a lot of <a href="https://www.reddit.com/r/rust/comments/njckp1/rustc_codegen_gcc_can_now_run_libcores_tests_and/">interest</a> about my work on the libgccjit backend for rustc, named <a href="https://github.com/antoyo/rustc_codegen_gcc">rustc_codegen_gcc</a>.<br>
Even though <a href="https://blog.antoyo.xyz/rustc_codegen_gcc-run-core-tests">it's still work-in-progress</a>, it would be interesting to start talking about a future integration into rustc main repository if that's something that interests the compiler team.</p>
<p>CC <span class="user-mention" data-user-id="239881">@Josh Triplett</span></p>



<a name="240139544"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Considering%20a%20future%20integration%20of%20the%20gcc%20backend/near/240139544" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend.html#240139544">(May 25 2021 at 03:47)</a>:</h4>
<p>I personally think this is really interesting work, and I think it would make sense to aim for it to be in-tree in the future, just like the cranelift backend.</p>



<a name="240139590"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Considering%20a%20future%20integration%20of%20the%20gcc%20backend/near/240139590" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend.html#240139590">(May 25 2021 at 03:48)</a>:</h4>
<p>It'll take time for it to get to a point where it passes the full testsuite, but I suggested that <span class="user-mention" data-user-id="404242">@antoyo</span> start the conversation here, and that we should start figuring out what the criteria would be.</p>



<a name="240139600"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Considering%20a%20future%20integration%20of%20the%20gcc%20backend/near/240139600" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend.html#240139600">(May 25 2021 at 03:49)</a>:</h4>
<p>This seems like something that might benefit from a compiler team design meeting.</p>



<a name="240139810"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Considering%20a%20future%20integration%20of%20the%20gcc%20backend/near/240139810" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend.html#240139810">(May 25 2021 at 03:54)</a>:</h4>
<p>Note that while libgccjit is GPL, <code>rustc_codegen_gcc</code> is (now) MIT/Apache-2.0. I think that'd be reasonable to have in-tree; we already do everything necessary to comply with that (we have no GPL-incompatible dependencies). We'd want to distribute the gcc backend separately, and make sure that anyone building or distributing that backend knows they need to provide full source to rustc, but anyone <em>not</em> building that backend would have no new license obligations.</p>



<a name="240165274"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Considering%20a%20future%20integration%20of%20the%20gcc%20backend/near/240165274" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend.html#240165274">(May 25 2021 at 10:01)</a>:</h4>
<p>I don't think rustc_codegen_gcc is allowed to be anything but GPL as it has a GPL dependency that can't be swapped out for a non-GPL dependency and is thus considered a derivative work, but IANAL.</p>



<a name="240192184"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Considering%20a%20future%20integration%20of%20the%20gcc%20backend/near/240192184" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend.html#240192184">(May 25 2021 at 14:04)</a>:</h4>
<p>Looks like this licensing question has come up before but wasn't answered <a href="https://gcc.gnu.org/legacy-ml/jit/2017-q3/msg00006.html">https://gcc.gnu.org/legacy-ml/jit/2017-q3/msg00006.html</a></p>



<a name="240192873"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Considering%20a%20future%20integration%20of%20the%20gcc%20backend/near/240192873" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bstrie <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend.html#240192873">(May 25 2021 at 14:09)</a>:</h4>
<p>by "we'd want to distribute the gcc backend separately", could it be distributed as a rustup component?</p>



<a name="240192889"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Considering%20a%20future%20integration%20of%20the%20gcc%20backend/near/240192889" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> antoyo <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend.html#240192889">(May 25 2021 at 14:09)</a>:</h4>
<p>I'm no expert, but after getting some explanations, I believe I understood why it's possible to use a non-GPL license for rustc_codegen_gcc:<br>
even though libgccjit is GPL, code using it can be non-GPL as long as it is compatible with GPL, <strong>but</strong> when you release the whole thing, the whole thing will have to be GPL.</p>



<a name="240207331"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Considering%20a%20future%20integration%20of%20the%20gcc%20backend/near/240207331" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend.html#240207331">(May 25 2021 at 15:43)</a>:</h4>
<p>rustc_codegen_gcc is required to be GPL-compatible. It's not required to be GPL.</p>



<a name="240207458"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Considering%20a%20future%20integration%20of%20the%20gcc%20backend/near/240207458" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend.html#240207458">(May 25 2021 at 15:44)</a>:</h4>
<p><span class="user-mention" data-user-id="256342">@bstrie</span> Yes.</p>



<a name="240214291"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Considering%20a%20future%20integration%20of%20the%20gcc%20backend/near/240214291" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend.html#240214291">(May 25 2021 at 16:29)</a>:</h4>
<p>if need be, the rust foundation should be able to clear that up if I understand correctly :)</p>



<a name="240214879"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Considering%20a%20future%20integration%20of%20the%20gcc%20backend/near/240214879" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bstrie <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend.html#240214879">(May 25 2021 at 16:33)</a>:</h4>
<p>in general it would be great if the foundation could provide access to some sort of licensing lawyer. then maybe rustc_apfloat could actually accept patches again :)</p>



<a name="240226208"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Considering%20a%20future%20integration%20of%20the%20gcc%20backend/near/240226208" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend.html#240226208">(May 25 2021 at 17:56)</a>:</h4>
<p>I don't know if the foundation is set up for that <em>yet</em>, but I will ask</p>



<a name="240264412"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Considering%20a%20future%20integration%20of%20the%20gcc%20backend/near/240264412" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend.html#240264412">(May 25 2021 at 23:47)</a>:</h4>
<p>This is an area I'm happy to help with. I dealt with licenses professionally for many years (as a non-lawyer working <em>with</em> lawyers).</p>



<a name="240264500"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Considering%20a%20future%20integration%20of%20the%20gcc%20backend/near/240264500" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend.html#240264500">(May 25 2021 at 23:48)</a>:</h4>
<p>In this case, I think the question is less "what can the Rust project legally do" (that's relatively clear in this case), and more "what policy does the Rust project want to have" (which is a question of policy based on available options determined by licensing).</p>



<a name="240264595"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Considering%20a%20future%20integration%20of%20the%20gcc%20backend/near/240264595" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend.html#240264595">(May 25 2021 at 23:50)</a>:</h4>
<p>That policy would be determined by the expectations of what Rust will do and what projects downstream of Rust will do and expect.</p>



<a name="240264647"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Considering%20a%20future%20integration%20of%20the%20gcc%20backend/near/240264647" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend.html#240264647">(May 25 2021 at 23:51)</a>:</h4>
<p>We want to maintain Rust's permissive licensing. We could that while providing optional separate components covered by copyleft. That requires <em>us</em> to comply with the copyleft license (which we already do by distributing full source under compatible licenses), but just requires people downstream of us to <em>either</em> comply <em>or</em> choose not to build/distribute those components.</p>



<a name="243653011"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Considering%20a%20future%20integration%20of%20the%20gcc%20backend/near/243653011" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend.html#243653011">(Jun 23 2021 at 13:41)</a>:</h4>
<p>I'd like to revive this discussion, given that the gcc backend now passes all the core tests: <a href="https://blog.antoyo.xyz/rustc_codegen_gcc-progress-report-1">https://blog.antoyo.xyz/rustc_codegen_gcc-progress-report-1</a></p>



<a name="243653206"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Considering%20a%20future%20integration%20of%20the%20gcc%20backend/near/243653206" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend.html#243653206">(Jun 23 2021 at 13:43)</a>:</h4>
<p>License considerations aside, assuming those are reviewed and addressed, what else would need to happen to make it reasonable to integrate?</p>



<a name="243655474"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Considering%20a%20future%20integration%20of%20the%20gcc%20backend/near/243655474" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend.html#243655474">(Jun 23 2021 at 13:59)</a>:</h4>
<p>Putting aside the licensing considerations, I think that all that really needs to happen is for an MCP to be created basically along the lines of the cranelift one. cg_gcc can probably copy the same approach used there. </p>
<p><a href="https://github.com/rust-lang/compiler-team/issues/270">https://github.com/rust-lang/compiler-team/issues/270</a></p>



<a name="243655511"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Considering%20a%20future%20integration%20of%20the%20gcc%20backend/near/243655511" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend.html#243655511">(Jun 23 2021 at 13:59)</a>:</h4>
<p>I think its worthwhile to consider if we want it to be a core component or a "tool" like e.g. miri is.</p>



<a name="243655633"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Considering%20a%20future%20integration%20of%20the%20gcc%20backend/near/243655633" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend.html#243655633">(Jun 23 2021 at 14:00)</a>:</h4>
<p>I don't personally fancy having to spend extra time on adjusting multiple backends (which would be necessary if it was a core component) when making the changes, even if I am very enthusiastic for cg_gcc.</p>



<a name="243656130"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Considering%20a%20future%20integration%20of%20the%20gcc%20backend/near/243656130" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend.html#243656130">(Jun 23 2021 at 14:03)</a>:</h4>
<p>For that reason I would strongly advise to approach this as a subtree inclusion kind of thing.</p>



<a name="243657728"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Considering%20a%20future%20integration%20of%20the%20gcc%20backend/near/243657728" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend.html#243657728">(Jun 23 2021 at 14:14)</a>:</h4>
<p>I think that makes sense while it's still under heavy development.</p>



<a name="243657834"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Considering%20a%20future%20integration%20of%20the%20gcc%20backend/near/243657834" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend.html#243657834">(Jun 23 2021 at 14:15)</a>:</h4>
<p>Once it's passing the whole testsuite, I'm hoping it might be reasonable to keep it building. But until it passes it certainly seems reasonable to not need to touch it.</p>



<a name="243658961"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Considering%20a%20future%20integration%20of%20the%20gcc%20backend/near/243658961" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend.html#243658961">(Jun 23 2021 at 14:22)</a>:</h4>
<p>Building is an easier hurdle yes. But for codegen backends that doesn't mean all that much.</p>



<a name="243659022"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Considering%20a%20future%20integration%20of%20the%20gcc%20backend/near/243659022" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend.html#243659022">(Jun 23 2021 at 14:23)</a>:</h4>
<p>True, but it's enough to be able to reliably distribute it via rustup.</p>



<a name="243659110"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Considering%20a%20future%20integration%20of%20the%20gcc%20backend/near/243659110" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend.html#243659110">(Jun 23 2021 at 14:24)</a>:</h4>
<p>Eventually, we'll likely end up with targets using it, in which case we'll naturally end up running tests for it.</p>



<a name="243659168"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Considering%20a%20future%20integration%20of%20the%20gcc%20backend/near/243659168" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend.html#243659168">(Jun 23 2021 at 14:24)</a>:</h4>
<p>But one step at a time.</p>



<a name="243659370"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Considering%20a%20future%20integration%20of%20the%20gcc%20backend/near/243659370" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend.html#243659370">(Jun 23 2021 at 14:25)</a>:</h4>
<p>I think it is also important for us as a team to decide on just how many backends are we willing to take responsibility for keeping building. 3 seems not all that outrageous yet, but I imagine it likely for people to come with their also reasonably motivated backends (e.g. I heard Microsoft having some interest in a backend that would generate machine code through MSVC toolchain's backends)</p>



<a name="243659573"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Considering%20a%20future%20integration%20of%20the%20gcc%20backend/near/243659573" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend.html#243659573">(Jun 23 2021 at 14:26)</a>:</h4>
<p><span class="user-mention" data-user-id="123586">@nagisa</span> I think it's reasonable to only take responsibility for Open Source backends; I don't think we should have in-tree support for proprietary backends.</p>



<a name="243659628"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Considering%20a%20future%20integration%20of%20the%20gcc%20backend/near/243659628" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend.html#243659628">(Jun 23 2021 at 14:27)</a>:</h4>
<p>And given that, there are only two major Open Source compiler backends, plus cranelift.</p>



<a name="243659895"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Considering%20a%20future%20integration%20of%20the%20gcc%20backend/near/243659895" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend.html#243659895">(Jun 23 2021 at 14:28)</a>:</h4>
<p>I think it will naturally fall out that there aren't other in-tree backends that apply to a large number of targets. One day there might be target-specific backends, like spirv from rust-gpu, but I would expect those to be entirely the responsibility of the target.</p>



<a name="243663557"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Considering%20a%20future%20integration%20of%20the%20gcc%20backend/near/243663557" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend.html#243663557">(Jun 23 2021 at 14:53)</a>:</h4>
<p>I think it is reasonable to start with gating PRs on cg_gcc builds and as the backend matures, we can strengthen those checks. That's essentially what cg_cranelift has done.</p>



<a name="243665524"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Considering%20a%20future%20integration%20of%20the%20gcc%20backend/near/243665524" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend.html#243665524">(Jun 23 2021 at 15:06)</a>:</h4>
<p><span class="user-mention" data-user-id="404242">@antoyo</span> I'd be happy to collaborate on drafting a compiler MCP.</p>



<a name="243666500"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Considering%20a%20future%20integration%20of%20the%20gcc%20backend/near/243666500" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> antoyo <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend.html#243666500">(Jun 23 2021 at 15:14)</a>:</h4>
<p><span class="user-mention silent" data-user-id="239881">Josh Triplett</span> <a href="#narrow/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend/near/243665524">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="404242">antoyo</span> I'd be happy to collaborate on drafting a compiler MCP.</p>
</blockquote>
<p>Nice. Where should we start?</p>



<a name="243666649"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Considering%20a%20future%20integration%20of%20the%20gcc%20backend/near/243666649" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend.html#243666649">(Jun 23 2021 at 15:15)</a>:</h4>
<p>How about a hackmd document based on the cranelift one linked above?</p>



<a name="243666668"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Considering%20a%20future%20integration%20of%20the%20gcc%20backend/near/243666668" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend.html#243666668">(Jun 23 2021 at 15:15)</a>:</h4>
<p>/me can create that.</p>



<a name="243666927"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Considering%20a%20future%20integration%20of%20the%20gcc%20backend/near/243666927" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend.html#243666927">(Jun 23 2021 at 15:17)</a>:</h4>
<p><a href="https://hackmd.io/xAjZTEDmRo-hAxEH9-1f3A">https://hackmd.io/xAjZTEDmRo-hAxEH9-1f3A</a></p>



<a name="243676047"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Considering%20a%20future%20integration%20of%20the%20gcc%20backend/near/243676047" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend.html#243676047">(Jun 23 2021 at 16:19)</a>:</h4>
<p><span class="user-mention" data-user-id="404242">@antoyo</span> How is that looking so far?</p>



<a name="243683082"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Considering%20a%20future%20integration%20of%20the%20gcc%20backend/near/243683082" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend.html#243683082">(Jun 23 2021 at 17:12)</a>:</h4>
<p>Currently a patches libgccjit is required by cg_gcc afaik. Whose responsibility will it be to built libgccjit? The user building rustbuild or rustc?</p>



<a name="243685070"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Considering%20a%20future%20integration%20of%20the%20gcc%20backend/near/243685070" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend.html#243685070">(Jun 23 2021 at 17:27)</a>:</h4>
<p><span class="user-mention" data-user-id="133247">@bjorn3</span> I would expect that <code>rustc_codegen_gcc</code> will not be built by default until it works with an unmodified upstream <code>libgccjit</code>.</p>



<a name="243685291"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Considering%20a%20future%20integration%20of%20the%20gcc%20backend/near/243685291" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend.html#243685291">(Jun 23 2021 at 17:28)</a>:</h4>
<p>That said, just as we have patches to LLVM (that we expect to upstream in the future), we could potentially have patches to GCC, and build our own GCC. But that would <em>substantially</em> add to the amount of time to build rustc. So, in practice I'm hoping that rustc CI will just be able to <code>apt install libgccjit-11-dev</code> or similar.</p>



<a name="243685292"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Considering%20a%20future%20integration%20of%20the%20gcc%20backend/near/243685292" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend.html#243685292">(Jun 23 2021 at 17:28)</a>:</h4>
<p>What does <code>cg_gcc</code> mean for someone building on Windows?  I'd really rather not have to install a MinGW toolchain to be able to build rust...</p>



<a name="243685373"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Considering%20a%20future%20integration%20of%20the%20gcc%20backend/near/243685373" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend.html#243685373">(Jun 23 2021 at 17:29)</a>:</h4>
<p><span class="user-mention" data-user-id="125270">@scottmcm</span> That definitely wouldn't be required. <code>rustc_codegen_gcc</code> would link to <code>libgccjit</code> which would do all the code generation.</p>



<a name="243685401"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Considering%20a%20future%20integration%20of%20the%20gcc%20backend/near/243685401" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend.html#243685401">(Jun 23 2021 at 17:29)</a>:</h4>
<p>Just as you don't have to install <code>clang</code> to use the LLVM backend, you won't have to install <code>gcc</code> to use the GCC backend.</p>



<a name="243685697"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Considering%20a%20future%20integration%20of%20the%20gcc%20backend/near/243685697" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend.html#243685697">(Jun 23 2021 at 17:31)</a>:</h4>
<p>I guess I was expecting that <code>libgccjit</code> wouldn't be buildable with msvc.  I guess the <del>target</del>backend could build, but just not link?</p>



<a name="243685831"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Considering%20a%20future%20integration%20of%20the%20gcc%20backend/near/243685831" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend.html#243685831">(Jun 23 2021 at 17:32)</a>:</h4>
<p>Ah, I see what you're getting at.</p>



<a name="243685868"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Considering%20a%20future%20integration%20of%20the%20gcc%20backend/near/243685868" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend.html#243685868">(Jun 23 2021 at 17:33)</a>:</h4>
<p>I'd expect that clang would be able to build libgccjit, though MSVC wouldn't.</p>



<a name="243685936"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Considering%20a%20future%20integration%20of%20the%20gcc%20backend/near/243685936" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend.html#243685936">(Jun 23 2021 at 17:34)</a>:</h4>
<p>I think your options would be:<br>
1) Use clang or similar to build libgccjit and install it somewhere that the Rust build can get at<br>
2) Use a pre-built libgccjit for Windows (potentially built by Rust CI, similar to the pre-built LLVM)<br>
3) Disable the GCC backend</p>



<a name="243686004"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Considering%20a%20future%20integration%20of%20the%20gcc%20backend/near/243686004" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend.html#243686004">(Jun 23 2021 at 17:34)</a>:</h4>
<p><span class="user-mention" data-user-id="125270">@scottmcm</span> Does that seem reasonable?</p>



<a name="243686072"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Considering%20a%20future%20integration%20of%20the%20gcc%20backend/near/243686072" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend.html#243686072">(Jun 23 2021 at 17:35)</a>:</h4>
<p>Another option is that we could disable the GCC backend by default on Windows targets, other than in CI.</p>



<a name="243686120"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Considering%20a%20future%20integration%20of%20the%20gcc%20backend/near/243686120" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend.html#243686120">(Jun 23 2021 at 17:35)</a>:</h4>
<p>Or have it on the -mingw targets but not the -msvc ones, yeah.</p>



<a name="243686319"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Considering%20a%20future%20integration%20of%20the%20gcc%20backend/near/243686319" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend.html#243686319">(Jun 23 2021 at 17:36)</a>:</h4>
<p>Hmm, if I step back for a second, I think the core issue is how much work it becomes to make basic backend changes.</p>



<a name="243686329"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Considering%20a%20future%20integration%20of%20the%20gcc%20backend/near/243686329" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend.html#243686329">(Jun 23 2021 at 17:36)</a>:</h4>
<p>It'd be helpful for the official binaries to have the backend on all targets with host tools, if in the future that allows supporting additional targets. But in the short term, I don't think it'd be a problem to just not have it available on Windows.</p>



<a name="243686386"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Considering%20a%20future%20integration%20of%20the%20gcc%20backend/near/243686386" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend.html#243686386">(Jun 23 2021 at 17:37)</a>:</h4>
<p><span class="user-mention silent" data-user-id="125270">scottmcm</span> <a href="#narrow/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend/near/243686319">said</a>:</p>
<blockquote>
<p>Hmm, if I step back for a second, I think the core issue is how much work it becomes to make basic backend changes.</p>
</blockquote>
<p>How much work has cg_clif added in that regard?</p>



<a name="243686539"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Considering%20a%20future%20integration%20of%20the%20gcc%20backend/near/243686539" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend.html#243686539">(Jun 23 2021 at 17:38)</a>:</h4>
<p>One thing that would be a big help for having multiple backends, I think, is the same thing that's been discussed for SIMD: having fallback MIR implementations of intrinsics (where possible) so that they don't need to be implemented perfectly for all the backends immediately.</p>
<p>That'd be really helpful for out-of-tree backends too.</p>



<a name="243686588"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Considering%20a%20future%20integration%20of%20the%20gcc%20backend/near/243686588" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend.html#243686588">(Jun 23 2021 at 17:38)</a>:</h4>
<p><span class="user-mention silent" data-user-id="239881">Josh Triplett</span> <a href="#narrow/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend/near/243686386">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="125270">scottmcm</span> <a href="#narrow/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend/near/243686319">said</a>:</p>
<blockquote>
<p>Hmm, if I step back for a second, I think the core issue is how much work it becomes to make basic backend changes.</p>
</blockquote>
<p>How much work has cg_clif added in that regard?</p>
</blockquote>
<p>More than cg_gcc will likely add. cg_gcc uses cg_ssa, while cg_clif directly uses mir.</p>



<a name="243686673"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Considering%20a%20future%20integration%20of%20the%20gcc%20backend/near/243686673" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend.html#243686673">(Jun 23 2021 at 17:39)</a>:</h4>
<p><span class="user-mention" data-user-id="125270">@scottmcm</span> Reducing the amount of required per-backend code does seem like a good idea, yeah.</p>



<a name="243686763"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Considering%20a%20future%20integration%20of%20the%20gcc%20backend/near/243686763" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend.html#243686763">(Jun 23 2021 at 17:40)</a>:</h4>
<p><span class="user-mention" data-user-id="125270">@scottmcm</span> Though in practice, if only a subset of backends use the pure-MIR fallbacks, that might mean the same amount of code anyway.</p>



<a name="243686825"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Considering%20a%20future%20integration%20of%20the%20gcc%20backend/near/243686825" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend.html#243686825">(Jun 23 2021 at 17:40)</a>:</h4>
<p>If there's an implementation for LLVM, and an implementation for GCC (since GCC may have a version of the intrinsic as well), and an implementation in pure MIR, that's three implementations anyway.</p>



<a name="243686895"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Considering%20a%20future%20integration%20of%20the%20gcc%20backend/near/243686895" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend.html#243686895">(Jun 23 2021 at 17:41)</a>:</h4>
<p>But on an intrinsic-by-intrinsic basis, it might turn out that some things don't need an implementation on all targets, so that still seems useful.</p>



<a name="243686905"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Considering%20a%20future%20integration%20of%20the%20gcc%20backend/near/243686905" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend.html#243686905">(Jun 23 2021 at 17:41)</a>:</h4>
<p><span class="user-mention silent" data-user-id="239881">Josh Triplett</span> <a href="#narrow/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend/near/243686386">said</a>:</p>
<blockquote>
<p>How much work has cg_clif added in that regard?</p>
</blockquote>
<p>It made <a href="https://github.com/rust-lang/rust/pull/85828">https://github.com/rust-lang/rust/pull/85828</a> maybe twice as much work, though part of that was just me needing to learn how cranelift works (and it not having a nice langref like LLVM does).</p>



<a name="243687695"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Considering%20a%20future%20integration%20of%20the%20gcc%20backend/near/243687695" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend.html#243687695">(Jun 23 2021 at 17:47)</a>:</h4>
<p><span class="user-mention silent" data-user-id="239881">Josh Triplett</span> <a href="#narrow/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend/near/243686763">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="125270">scottmcm</span> Though in practice, if only a subset of backends use the pure-MIR fallbacks, that might mean the same amount of code anyway.</p>
</blockquote>
<p>I think the core difference is in staging of the changes.  It's not the amount of code that's the problem; it's that it can't be added anywhere without touching cg_llvm <em>and</em> cg_clif <em>and</em> miri <em>and</em> cg_gcc.</p>
<p>If the first step for a new intrinsic was just "add it as just the <code>core::intrinsics</code> signature, with the MIR fallback" then that can be done independently, with all the specific backends choosing whether they need something custom separately -- at least one certainly would, but that makes it become a separable concern.</p>
<p>(And having the MIR implementation, where possible, would be nice for the specification.  And we tend to write suboptimal rust implementations of new things -- at least for easy things like <code>cttz_nonzero</code> anyway -- as part of bootstrapping, so just keeping those around wouldn't be much extra work.)</p>
<p>I think it'll be great to have the GCC backend.  I just want to find a way to make it not too annoying to do something like add an intrinsic.</p>



<a name="243687836"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Considering%20a%20future%20integration%20of%20the%20gcc%20backend/near/243687836" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend.html#243687836">(Jun 23 2021 at 17:48)</a>:</h4>
<p>A lot of intrinsics can probably be implemented in cg_ssa making it available to all backends using cg_ssa.</p>



<a name="243692218"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Considering%20a%20future%20integration%20of%20the%20gcc%20backend/near/243692218" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> antoyo <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend.html#243692218">(Jun 23 2021 at 18:19)</a>:</h4>
<p><span class="user-mention" data-user-id="239881">@Josh Triplett</span> I'll look at this document later.</p>
<p>For the intrinsics, I had to manually implement a bunch of those in <code>rustc_codegen_gcc</code> and I took care to implement them using branch-free algorithms, so maybe we could reuse those implementations.</p>



<a name="243692768"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Considering%20a%20future%20integration%20of%20the%20gcc%20backend/near/243692768" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend.html#243692768">(Jun 23 2021 at 18:23)</a>:</h4>
<p>Interesting!</p>



<a name="243693990"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Considering%20a%20future%20integration%20of%20the%20gcc%20backend/near/243693990" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend.html#243693990">(Jun 23 2021 at 18:32)</a>:</h4>
<p>FWIW, there's a GNU Tools track at LPC (in lieu of Cauldron)<br>
<a href="https://gcc.gnu.org/wiki/linuxplumbers2021">https://gcc.gnu.org/wiki/linuxplumbers2021</a></p>



<a name="243694090"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Considering%20a%20future%20integration%20of%20the%20gcc%20backend/near/243694090" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend.html#243694090">(Jun 23 2021 at 18:33)</a>:</h4>
<p>I expect gcc-rs and rustc_codegen_gcc would both be welcome there</p>



<a name="243694966"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Considering%20a%20future%20integration%20of%20the%20gcc%20backend/near/243694966" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> antoyo <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend.html#243694966">(Jun 23 2021 at 18:40)</a>:</h4>
<p><span class="user-mention silent" data-user-id="138448">cuviper</span> <a href="#narrow/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend/near/243693990">said</a>:</p>
<blockquote>
<p>FWIW, there's a GNU Tools track at LPC (in lieu of Cauldron)<br>
<a href="https://gcc.gnu.org/wiki/linuxplumbers2021">https://gcc.gnu.org/wiki/linuxplumbers2021</a></p>
</blockquote>
<p>I submitted a proposal for the Refereed Track. Would it be better suited to the GNU Tools track?</p>



<a name="243697958"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Considering%20a%20future%20integration%20of%20the%20gcc%20backend/near/243697958" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend.html#243697958">(Jun 23 2021 at 19:04)</a>:</h4>
<p><span class="user-mention" data-user-id="404242">@antoyo</span> I would definitely go with the Refereed Track, and if not that, then the toolchain track that includes Rust. (That's separate from the GNU Tools track, I believe.)</p>



<a name="243698783"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Considering%20a%20future%20integration%20of%20the%20gcc%20backend/near/243698783" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend.html#243698783">(Jun 23 2021 at 19:11)</a>:</h4>
<p>I guess it depends on who you want to engage with</p>



<a name="243708079"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Considering%20a%20future%20integration%20of%20the%20gcc%20backend/near/243708079" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend.html#243708079">(Jun 23 2021 at 20:28)</a>:</h4>
<p>True. I was thinking about broader-scale Rust interest and toolchain interest.</p>



<a name="243708097"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Considering%20a%20future%20integration%20of%20the%20gcc%20backend/near/243708097" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend.html#243708097">(Jun 23 2021 at 20:28)</a>:</h4>
<p>GNU Tools would make sense for a conversation that's primarily with GCC folks.</p>



<a name="243776197"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Considering%20a%20future%20integration%20of%20the%20gcc%20backend/near/243776197" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> antoyo <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend.html#243776197">(Jun 24 2021 at 12:18)</a>:</h4>
<p><span class="user-mention silent" data-user-id="239881">Josh Triplett</span> <a href="#narrow/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend/near/243676047">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="404242">antoyo</span> How is that looking so far?</p>
</blockquote>
<p>That's perfect!<br>
What would be the next step?</p>



<a name="243781632"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Considering%20a%20future%20integration%20of%20the%20gcc%20backend/near/243781632" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend.html#243781632">(Jun 24 2021 at 13:00)</a>:</h4>
<p>Opening the MCP I guess: <a href="https://github.com/rust-lang/compiler-team/issues/new?assignees=&amp;labels=major-change%2C+T-compiler&amp;template=major_change.md&amp;title=%28My+major+change+proposal%29">https://github.com/rust-lang/compiler-team/issues/new?assignees=&amp;labels=major-change%2C+T-compiler&amp;template=major_change.md&amp;title=%28My+major+change+proposal%29</a></p>



<a name="243807364"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Considering%20a%20future%20integration%20of%20the%20gcc%20backend/near/243807364" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend.html#243807364">(Jun 24 2021 at 15:58)</a>:</h4>
<p>Right. Whenever you're ready, <span class="user-mention" data-user-id="404242">@antoyo</span> , you should open the MCP.</p>



<a name="243808888"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Considering%20a%20future%20integration%20of%20the%20gcc%20backend/near/243808888" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> antoyo <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Considering.20a.20future.20integration.20of.20the.20gcc.20backend.html#243808888">(Jun 24 2021 at 16:09)</a>:</h4>
<p><a href="https://github.com/rust-lang/compiler-team/issues/442">There you go.</a></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>